import { defineStore } from "pinia";
import type { StateType, UsetInfoType } from "@/type/store/useStore";
const useStore = defineStore("useStore", {
  state: (): StateType => {
    return {
      token: "",
      userInfo: {},
    };
  },
  getters: {
    getToken(): string {
      return this.token;
    },
    getUserInfo(): UsetInfoType {
      return this.userInfo;
    },
  },
  actions: {
    async setToken(val: string) {
      this.token = val;
    },
    async setUserInfo(val: UsetInfoType) {
      this.userInfo = val;
    },
    persist: true,
  },
});
export default useStore;
